// 定义接口参数
export interface IParams {
  request?: any // 请求条件
  action: string, // 请求地址（后缀）
  mode?: string, // 请求方式（GET/POST）
  gateway?: string, // 请求地址（前缀，开发用）
  wantedHead?: boolean, // 是否需要带入请求头Token
  uploadProgressHandler?: (percent: any) => any, // 上传文件进度函数
}

export interface IPromise {
  (params: IParams): Promise<any>
}

// 后端返回数据格式，不可更改（需与后端匹配）
export interface IBackEndReturn {
  code: string
  data: any
  msg: string
}

// request处理后的返回格式
export interface IHandleReturn {
  action: string
  code: string
  message: string
  response?: any
  error?: any
  status: number
  type?: string
}

// store action
export interface IStoreAction {
  type: string
  response?: any
  error?: any
}

// store state
export interface IStoreState {
  loading: boolean
}

// svg
export interface ISvgProps {
  color?: string,
  hoverColor?: string,
  onMouseEnter?: (event: React.MouseEvent) => void,
  onMouseLeave?: (event: React.MouseEvent) => void,
  style?: React.CSSProperties,
  viewBox?: string,
}

export interface IUploadFile {
  name: string
  size: number
  type: string
  uid: string
  [propName: string]: any
}
